# -*- coding: utf-8 -*-

# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html
import pymysql

class ZhihuPipeline(object):
	def process_item(self, item, spider):
		db = pymysql.connect("localhost","root","*******","zhihu" )
		cursor = db.cursor()
		cursor.execute('INSERT INTO classify(className, classUrl, ifGain) VALUES ("'+item['className']+'", "'+item['classUrl']+'", "0")')
		db.close()
		return item
